package routes

import akka.actor.ActorSystem
import akka.http.scaladsl.server._
import akka.stream.Materializer
import common.RoutesDefinition
import play.api.libs.json.JsValue

class InternalHealthRoutes(
    implicit
    val system: ActorSystem,
    val materializer: Materializer
) extends RoutesDefinition {

  def routes: Route = pathPrefix("internal") {
    path("health") {
      complete("Ok")
    } ~
      (path("emqx") & post) {
        complete("Ok")
        entity(as[JsValue]) { jsValue ⇒

          Logger.debug("Received Emqx Event {} ", jsValue)
          complete("Ok")
        }
      }
  }
}
